'use strict';
const db = uniCloud.database();
exports.main = async (event, context) => {
  //event为客户端上传的参数
 const fs = require("fs");
 const collection = db.collection('tasks');

	let task={
		"task_id":event.task_id,
		"user_name":event.user_name,
		"user_id":event.user_id,
		"user_icon":event.user_icon,
		"content":event.content,
		"time":event.time,
		"reward":event.reward,
		"address":event.address,
		"phone":event.phone,
		"receiver_icon":"",
		"receiver_name":"",
		"receiver_id":"",
		"receiver_address":"",
		"receiver_phone":"",
		"is_received":false,
		"is_finished":false
	};
	let res=await collection.add(task);
  //返回数据给客户端
  return {"status":2}
};
